﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;

namespace DAO {
    public class LopDAO {
        public List<LopDTO> getLop()
        {
            List<LopDTO> list = new List<LopDTO>();

            ProviderDataContext context = new ProviderDataContext();
            var entities = from entity in context.Lops
                           select entity;

            foreach(var entity in entities){
                LopDTO dto = new LopDTO();
                dto.MaK = entity.MaKhoi;
                dto.MaL = entity.MaL;
                dto.TenL = entity.TenLop;

                list.Add(dto);
            }
            return list;
        }
    }
}
